﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Scheduling.Models
{
    public enum DayType
    {
        Every = 0,
        Odd = 1,
        Even = 2
    }
    public enum Priority
    {
        Neither = 0,
        Room = 1,
        Time = 2
    }
    public enum RoomType
    {
        LectureHall, AssemblyRoom, ComputerRoom, ConferenceRoom, LabRoom, SpecialRoom
    }
    public class BookingRequest
    {
        public int ID { get; set; }

        /// <summary>
        /// The year of the requested booking.
        /// </summary>
        public int Year { get; set; }

        /// <summary>
        /// The preferred start time.
        /// </summary>
        public int Time { get; set; }

        /// <summary>
        /// The course period.
        /// </summary>
        public int StartPeriod { get; set; }

        /// <summary>
        /// Number of lectures requested.
        /// </summary>
        public int LectureCount { get; set; }

        /// <summary>
        /// The length of each lecture in the course.
        /// </summary>
        public int LectureLength { get; set; }

        /// <summary>
        /// Minimum number of chairs in room.
        /// </summary>
        public int RequiredCapacity { get; set; }

        /// <summary>
        /// Desired building/floor/room.
        /// </summary>
        public string RoomPattern { get; set; }

        /// <summary>
        /// The booker who made the request.
        /// </summary>
        public User Booker { get; set; }

        /// <summary>
        /// The course instance for which bookings have been requested.
        /// </summary>
        public CourseInstance CourseInstance { get; set; }

        /// <summary>
        /// Specifies if time or room should be prioritized when processing the booking request.
        /// </summary>
        public Priority Priority { get; set; }

        /// <summary>
        /// The type of room requested by booker.
        /// </summary>
        public RoomType RoomType { get; set; }

        /// <summary>
        /// Defines which days of week the course will take place.
        /// </summary>
        public Dictionary<DayOfWeek, DayType> AllowedDays { get; set; }

        public override string ToString()
        {
            return string.Format("{0} wants {1} at {2} for {3} hours /w at least {4} seats. {5} over {6} ({7}) \n",
                Booker.ID, RoomPattern, Time + ":15", LectureLength, RequiredCapacity, 
                Priority, this.Priority == Priority.Time ? Priority.Room : Priority.Time, LectureCount);
        }
    }
}